<template>
  <div class="home-pic-box">
    <div class="menuTit flex align-center justify-between">
      <div class="base-font-18 text-333">
        <div class="titleLine"> 社区热图</div>
      </div>
      <div>
        <div class="flex align-center">
          <div class="base-font-14 text-999 margin-left-15">街拍</div>
          <div class="base-font-14 text-999 margin-left-15">自由拍</div>
          <div class="base-font-14 text-999 margin-left-15">街拍</div>
          <div class="base-font-14 text-999 margin-left-15">街拍</div>
        </div>
      </div>
    </div>
    <div class="flex align-center justify-between hotPicBlock padding-tb-20 text-white" v-if="websiteArticles.length>0">
      <div class="hotPicItem">
        <div class="hotPicItemImg block1" @click="goDetail(websiteArticles[0].id)">
          <div class="blackBlock ">
            <div class="flex align-center">
              <div >
                <div class="base-font-18 ellipsis2">{{websiteArticles[0].title}}</div>
                <div class="base-font-16 margin-top-15 ellipsis4" style="opacity:0.8;">{{websiteArticles[0].description}}
                </div>
              </div>
            </div>
          </div>
          <el-image :src="websiteArticles[0].image" fit="cover"></el-image>
        </div>
        <div class="hotPicItemImg block2 margin-top-5" @click="goDetail(websiteArticles[1].id)">
          <div class="blackBlock ">
            <div class="flex align-center">
              <div >
                <div class="base-font-18 ellipsis2">{{websiteArticles[1].title}}</div>
                <div class="base-font-16 margin-top-15 ellipsis2" style="opacity:0.8;">{{websiteArticles[1].description}}
                </div>
              </div>
            </div>
          </div>
          <el-image :src="websiteArticles[1].image" fit="cover"></el-image>

        </div>
      </div>
      <div class="hotPicItem">
        <div class="hotPicItemImg block2" @click="goDetail(websiteArticles[2].id)">
          <div class="blackBlock ">
            <div class="flex align-center">
              <div >
                <div class="base-font-18 ellipsis2">{{websiteArticles[2].title}}</div>
                <div class="base-font-16 margin-top-15 ellipsis2" style="opacity:0.8;">{{websiteArticles[2].description}}
                </div>
              </div>
            </div>
          </div>
          <el-image :src="websiteArticles[2].image" fit="cover"></el-image>
        </div>
        <div class="hotPicItemImg block1 margin-top-5" @click="goDetail(websiteArticles[3].id)">
          <div class="blackBlock ">
            <div class="flex align-center">
              <div >
                <div class="base-font-18 ellipsis2">{{websiteArticles[3].title}}</div>
                <div class="base-font-16 margin-top-15 ellipsis2" style="opacity:0.8;">{{websiteArticles[3].description}}
                </div>
              </div>
            </div>
          </div>
          <el-image :src="websiteArticles[3].image" fit="cover"></el-image>
        </div>
      </div>
      <div class="hotPicItem bigBlock" @click="goDetail(websiteArticles[4].id)">
        <div class="hotPicItemImg block1">
          <div class="blackBlock ">
            <div class="flex align-center">
              <div >
                <div class="base-font-18 ellipsis2">{{websiteArticles[4].title}}</div>
                <div class="base-font-16 margin-top-15 ellipsis2" style="opacity:0.8;">{{websiteArticles[4].description}}
                </div>
              </div>
            </div>
          </div>
          <el-image :src="websiteArticles[4].image" fit="cover"></el-image>
        </div>
        <div class="hotPicItemImg block2 margin-top-5" @click="goDetail(websiteArticles[5].id)">
          <div class="blackBlock ">
            <div class="flex align-center">
              <div >
                <div class="base-font-18 ellipsis">{{websiteArticles[5].title}}</div>
                <div class="base-font-16 margin-top-15 ellipsis2" style="opacity:0.8;">{{websiteArticles[5].description}}
                </div>
              </div>
            </div>
          </div>
          <el-image :src="websiteArticles[5].image" fit="cover"></el-image>
        </div>
      </div>
      <div class="hotPicItem">
        <div class="hotPicItemImg block1" @click="goDetail(websiteArticles[6].id)">
          <div class="blackBlock ">
            <div class="flex align-center">
              <div >
                <div class="base-font-18 ellipsis2">{{websiteArticles[6].title}}</div>
                <div class="base-font-16 margin-top-15 ellipsis2" style="opacity:0.8;">{{websiteArticles[6].description}}
                </div>
              </div>
            </div>
          </div>
          <el-image :src="websiteArticles[6].image" fit="cover"></el-image>
        </div>
        <div class="hotPicItemImg block2 margin-top-5" @click="goDetail(websiteArticles[7].id)">
          <div class="blackBlock ">
            <div class="flex align-center">
              <div >
                <div class="base-font-18 ellipsis2">{{websiteArticles[7].title}}</div>
                <div class="base-font-16 margin-top-15 ellipsis2" style="opacity:0.8;">{{websiteArticles[7].description}}
                </div>
              </div>
            </div>
          </div>
          <el-image :src="websiteArticles[7].image" fit="cover"></el-image>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    props: {
      websiteArticles: {
        type: Array,
        default: []
      }
    },
    data() {
      return {

      }
    },
    methods:{
goDetail(id) {
        this.$router.push({
          path: '/detail',
          query: {
            id: id,
          }
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
  .home-pic-box {
    width: 100%;
    height: auto;

    .menuTit {
      width: 100%;
      height: 45px;
      border-bottom: 1px solid #caccd4;
      line-height: 45px;
      border-bottom: 1px solid #caccd4;

      .titleLine {
        height: 44px;
        position: relative;

        &:before {
          content: '';
          display: block;
          width: 100%;
          height: 1px;
          border-bottom: 1px solid #ef9b76;
          position: absolute;
          left: 0;
          bottom: -1px;
        }
      }
    }

    .hotPicItem {
      width: 247px;
      height: 445px;
      color: #FFFFFF;

      .hotPicItemImg {
        position: relative;
        cursor: pointer;
        overflow: hidden;

        &.block1 {
          width: 100%;
          height: 280px;
          .blackBlock{
             height: 280px;
             .flex{
               height: 280px;
             }
          }

          .el-image {
            width: 100%;
            height: 280px;
          }
          &:hover{
            .blackBlock{
              display: block;
              height: 280px;
              left:0;top:0;
              transition: all 0.4s linear;
              -webkit-transition: all 0.4s linear;
            }
          }

        }

        &.block2 {
          width: 100%;
          height: 160px;
          .blackBlock{
             height: 160px;
             .flex{
               height: 160px;
             }
          }

          .el-image {
            width: 100%;
            height: 160px;
          }
          &:hover{
            .blackBlock{
              display: block;
              height: 160px;
              left:0;top:0;
              transition: all 0.4s linear;
              -webkit-transition: all 0.4s linear;
            }
          }
        }

        .blackBlock {
          padding: 0 20px;
          box-sizing: border-box;
          line-height: 1.5;
          position: absolute;
          z-index: 999;
          width: 100%;
          height: 0;
          background: rgba(0, 0, 0, 0.7);
          display: none;
          left:0;top:100%;
          transition: top 0.4s linear;
          -webkit-transition: top 0.4s linear;
        }
        &:hover{

        }
      }

      &.bigBlock {
        width: 445px;
        height: 445px;
      }



    }
  }
</style>
